export const streamConfig = {
  // 流媒体服务器配置
  mediaServer: {
    rtmp: {
      port: 1935,
      host: '0.0.0.0',
      chunk_size: 60000,
      gop_cache: true,
      ping: 30,
      ping_timeout: 60,
    },
    http: {
      port: 8000,
      host: '0.0.0.0',
      allow_origin: '*',
      mediaroot: './media',
    },
    https: {
      port: 8443,
      host: '0.0.0.0',
      key: './privatekey.pem',
      cert: './certificate.pem',
    },
    webrtc: {
      port: 8088,
      host: '0.0.0.0',
      iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
    },
    auth: {
      api: true,
      api_user: 'admin',
      api_pass: 'admin',
    },
    trans: {
      ffmpeg: process.platform === 'win32' ? 'C:\\ffmpeg\\bin\\ffmpeg.exe' : 'ffmpeg',
      tasks: [
        {
          app: 'live',
          hls: true,
          hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
        },
      ],
    },
  },

  // 第三方推流配置
  thirdParty: {
    enabled: true,
    // 腾讯云配置
    tencent: {
      secretId: process.env.TENCENT_SECRET_ID,
      secretKey: process.env.TENCENT_SECRET_KEY,
      pushDomain: process.env.TENCENT_PUSH_DOMAIN,
      appName: 'live',
    },
    // 阿里云配置
    aliyun: {
      accessKey: process.env.ALIYUN_ACCESS_KEY,
      secretKey: process.env.ALIYUN_SECRET_KEY,
      pushDomain: process.env.ALIYUN_PUSH_DOMAIN,
      appName: 'live',
    },
    // 七牛云配置
    qiniu: {
      accessKey: process.env.QINIU_ACCESS_KEY,
      secretKey: process.env.QINIU_SECRET_KEY,
      pushDomain: process.env.QINIU_PUSH_DOMAIN,
      hub: 'live',
    },
  },

  // 推流密钥配置
  keyExpireTime: 7200, // 密钥有效期(秒)

  // 转码配置
  transcoding: {
    enabled: true,
    profiles: [
      {
        name: '720p',
        resolution: '1280x720',
        bitrate: '2000k',
        fps: 30,
      },
      {
        name: '480p',
        resolution: '854x480',
        bitrate: '1000k',
        fps: 30,
      },
      {
        name: '360p',
        resolution: '640x360',
        bitrate: '600k',
        fps: 25,
      },
    ],
  },

  // 录制配置
  recording: {
    enabled: true,
    format: 'mp4',
    savePath: './records',
    maxDuration: 7200, // 最大录制时长(秒)
  },
}
